home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Libraries / SAT 2.4.0 / SAT / Add-ons / Lib ƒ / SATAddOnLib.h < prev    next >
Encoding:
Text File  |  1997-02-21  |  5.0 KB  |  120 lines  |  [TEXT/KAHL]

  1. /*SATAddOnLib is a lib of the "Add-ons" that are easily put in a library (i.e. the ones without*/
  2. /*a "stubs" file). They include:*/
  3.  
  4. /*AlphaSAT*/
  5. /*GammaFade*/
  6. /*ProgressBar*/
  7. /*FaceFromPict*/
  8. /*SATToolbox*/
  9. /*Preferences*/
  10. /*Pixels*/
  11.  
  12.  
  13.  
  14. /**** AlphaSAT ****/
  15.  
  16.     pascal void SATFillAlphaRect (Rect box, SATPort port);
  17.     pascal void SATPaintAlphaRect (Rect box, SATPort port, short value);
  18.     pascal void SATEraseAlphaRect (Rect box, SATPort port);
  19.  
  20.  
  21. /**** GammaFade ****/
  22. /*Screen fading routines.*/
  23.  
  24. pascal void FadeToBlack(long ticks);
  25. pascal void FadeFromBlack(long ticks);
  26. pascal FacePtr GetFaceFromPICT(short colorPICTid,short bwPICTid,short maskPICTid);
  27.  
  28. /* Pixel array types and routines */
  29.  typedef struct Pixel {
  30.     Point position;
  31.     char data1, data2, data3, data4;
  32.    } Pixel, Pixels, *PixelPtr;
  33.  
  34.  pascal void SATDrawPixels (PixelPtr pix, SATPort *port, long value);
  35.  pascal void SATCopyPixels (PixelPtr pix, SATPort *src, SATPort *dest);
  36.  pascal void SATDrawPixelsSafe (PixelPtr pix, SATPort *port, long value);
  37.  pascal void SATCopyPixelsSafe (PixelPtr pix, SATPort *src, SATPort *dest);
  38.  
  39. /* Preference file handling */
  40.  
  41. pascal Boolean SetPrefFile(Str255 prefsFileName, OSType prefCreator,OSType prefType, short *appFile, short *prefFile, Boolean alwaysExternal);
  42. pascal OSErr CopyResource(short fromFile, short toFile, ResType theResType, short id);
  43.  
  44. /* Progress bar */
  45.  
  46. typedef Ptr ProgressBarColorPtr;
  47. typedef Ptr ProgressBarPtr;
  48.  
  49. pascal ProgressBarPtr InitProgressBar(short prefFile,short resID, Rect bounds, ProgressBarColorPtr colors);
  50. pascal ProgressBarColorPtr ProgressBarColors(
  51.                 short frameRed,short frameGreen,short frameBlue,
  52.                 short backRed,short backGreen,short backBlue,
  53.                 short foreRed,short foreGreen,short foreBlue);
  54. pascal ProgressBarColorPtr ProgressBarColorsRGB(RGBColor frame,RGBColor back,RGBColor fore);
  55. pascal void AdvanceProgressBar(ProgressBarPtr thePB);
  56. pascal void FinishProgressBar(ProgressBarPtr thePB);
  57.  
  58. /* Sprite record for sprites with fixed-point movement */
  59.  
  60.          typedef struct {
  61. /* Variables that you should change as appropriate */
  62.                 short kind; /* Used for identification. >0: friend. <0 foe */
  63.                 Point position;
  64.                 Rect hotRect, hotRect2; /* Tells how large the sprite is; hotRect is centered around origo */
  65.                                     /*hotRect is set by you. hotRect2 is offset to the current position.*/
  66.                 FacePtr face;            /* Pointer to the Face (appearance) to be used. */
  67.                 ProcPtr task;            /* Callback-routine, called once per frame. If task=nil, the sprite is removed. */
  68.                 ProcPtr hitTask;        /* Callback in collisions. */
  69.                 ProcPtr destructTask;    /* Called when a sprite is disposed. (Usually nil.) */
  70.                 RgnHandle clip;            /*Clip region to be used when this sprite is drawn.*/
  71. /* SAT variables that you shouldn't change: */
  72.                 Point oldpos;                /*Used by RunSAT2*/
  73.                 SpritePtr next, prev;    /*You may change them in your own sorting routine, but be careful if you do.*/
  74.                 Rect r, oldr;                /*Rectangle telling where to draw. Avoid messing with it.*/
  75.                 FacePtr oldFace;            /*Used by RunSAT2*/
  76.                 Boolean dirty;            /*Used by RunSAT2*/
  77. /*Variables for internal use by the sprites. Use as you please. Edit as necessary - this is merely a default*/
  78. /*set, enough space for most cases - but if you change the size of the record, call SetSpriteSize immediately*/
  79. /*after initializing (before any sprites are created)!*/
  80.                 short layer; /*For layer-sorting. When not used for that, use freely.*/
  81.                 Point speed; /* Can be used for speed, but not necessarily. */
  82.                 short mode; /* Usually used for different modes and/or to determine what image to show next. */
  83.                 Point fixedPointPosition; /*fixed point position*/
  84.                 long appLong; /*Longint for free use by the application.*/
  85.             } FixSprite, *FixSpritePtr;
  86.  
  87. /*Constants for separation/bounceoff between sprites*/
  88.  
  89. #define kPushBoth 0
  90. #define kPushMe 1
  91. #define kPushHim 2
  92.  
  93. /*Sprite utilities*/
  94.  
  95. pascal void MoveSprite(SpritePtr theSprite);
  96. pascal Boolean KeepOnScreen(SpritePtr theSprite);
  97. pascal void MoveSpriteFixedPoint(FixSpritePtr theSprite);
  98. pascal Boolean KeepOnScreenFixed(FixSpritePtr theSprite);
  99. pascal short RectSeparate(SpritePtr theSprite, SpritePtr anotherSprite, short push);
  100. pascal void RectBounce(SpritePtr me, SpritePtr him, short push);
  101. pascal void RectBounceFixed(FixSpritePtr me,FixSpritePtr him, short push);
  102. pascal Boolean PtInSpriteRgn(Point p, SpritePtr theSprite);
  103. pascal Boolean RegionHit(SpritePtr theSprite, SpritePtr anotherSprite);
  104. pascal void SplitVector(Point v, Point d, Point * p, Point * n);
  105. pascal void RegionBounce(FixSpritePtr s1, FixSpritePtr s2);
  106.  
  107. /**** Look-up table based fixed-point math operations. ****/
  108. /*Good for high-speed math on 68k Macs.*/
  109.  
  110. /*Don't change these constants without recompiling the lib!*/
  111. #define    kFixedPointShift    4    /*Number of fixed-point positions*/
  112. #define    kFixedOne    16            /*The "one" in the fixed-point system being used!*/
  113.  
  114. pascal void InitTables();
  115. pascal long SquareRoot(long arg);
  116. pascal long Sinus(long arg);
  117. pascal long Cosinus(long arg);
  118. pascal long VectorLength(Point vector);
  119. pascal long FPVectorLength(Point vector);
  120.